/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.templates;

import java.util.Collections;
import java.util.List;

import com.lineage.server.utils.collections.Lists;

/**
 * Class <code>L1MobGroup</code> 数据库模板:怪物群组.
 * 
 * @author jrwz
 * @version 2012-6-17上午04:20:44
 * @see com.lineage.server.templates
 * @since JDK1.7
 */
public final class L1MobGroup {

    /** 群组编号. */
    private final int groupId;
    /** 领导者编号. */
    private final int groupLeaderId;
    /** 跟随者(集合列表). */
    private final List<L1NpcCount> groupMinions = Lists.newList();
    /** 如果领导者死亡是否删除整个群组内的怪物. */
    private final boolean isRemoveGroupIfLeaderDie;

    /**
     * 数据库模板:怪物群组.
     * 
     * @param id
     *            编号
     * @param leaderId
     *            领导者编号
     * @param minions
     *            跟随者(集合列表)
     * @param flag
     *            如果领导者死亡是否删除整个群组内的怪物
     */
    public L1MobGroup(final int id, final int leaderId,
            final List<L1NpcCount> minions, final boolean flag) {
        this.groupId = id;
        this.groupLeaderId = leaderId;
        this.groupMinions.addAll(minions); // 参考拷贝的方法会更快一些、但无法保证不变性
        this.isRemoveGroupIfLeaderDie = flag;
    }

    /**
     * 取得编号.
     * 
     * @return 编号
     */
    public int getId() {
        return this.groupId;
    }

    /**
     * 取得领导者编号.
     * 
     * @return 领导者编号
     */
    public int getLeaderId() {
        return this.groupLeaderId;
    }

    /**
     * 取得跟随者(集合列表).
     * 
     * @return 跟随者(集合列表)
     */
    public List<L1NpcCount> getMinions() {
        return Collections.unmodifiableList(this.groupMinions);
    }

    /**
     * 如果领导者死亡是否删除整个群组内的怪物.
     * 
     * @return true or false
     */
    public boolean isRemoveGroupIfLeaderDie() {
        return this.isRemoveGroupIfLeaderDie;
    }
}
